Optimize crawl_build_deps to not re-traverse deps
authorAlex Crichton <alex@alexcrichton.com>
Sat, 30 May 2015 01:40:42 +0000 (18:40 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 3 Jun 2015 01:05:47 +0000 (18:05 -0700)
commit5a953eb03b8d2d08c7c727edb603745f3ac51505
tree1fe533f499140ae87fd69cc01cdb10fe46f16755
parent499f485f3d34a53fcedb4a2ea95f9aff9bff8241
Optimize crawl_build_deps to not re-traverse deps

This function previously, for each dependency, traversed the entire dependency
graph. This ended up taking quite a bit of time as a huge amount of hashing was
being done (each of which is somewhat nontrivial). This commit alters the logic
to instead precompute a table of all the native dependencies that each crate
will need, traversing the dependency graph only once instead of repeatedly.

This commit takes a noop build of Servo from 2.1s to 0.4s
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/custom_build.rs
src/cargo/ops/cargo_rustc/mod.rs
tests/test_cargo_compile_custom_build.rs
tests/test_cargo_compile_plugins.rs